#include <iostream>
#include <iomanip>
#include <fstream>
#include <cstdlib>
#include <ctime>
#include <algorithm>
#include <numeric>
#include <vector>
#include <iterator>
#include <functional>
#include <boost/bind.hpp>
#include <boost/timer.hpp>
#include <boost/shared_ptr.hpp>

using namespace std;

void Test1()
{
	int a[10];
	a[10]=10;
}

void Test2()
{
	const int size = 100;
	int *p = new int [size];
	p[100] = 5;
	cout<<p[100]<<endl;
	cout<<(p[101]=6)<<endl;
	//delete p;//error
}

void Test3()
{
	char *p1 = new char[1];
	*p1 = 'a';

	char *p2 = new char[1];
	*p2 = 'x';

	*++p1 = 'o';
	cout<<*p2<<endl;

}

void Test4()
{
	//maybe could be hashcode
	int *p = new int;
	cout<<"0x"<<hex<<reinterpret_cast<int>(p)<<endl; 
	cout<<p<<endl; 

	/*
	 * ,号表达式从左到右求值。
	 *
	 */
	cout<<(2,3,4,5,6,7,8,9)<<endl;

	int a=3,b=4,c=5,d=6;
	cout<<(a,b,c,d)<<endl;

	cout<<(a++,a++,a++,a++,a++,a++)<<endl;
}

void f(int a,int b)
{
	cout<<"a -> "<<a<<endl
	    <<"b -> "<<b<<endl;
}

void Test5()
{
	int i = 1;
	//NEVER USE THIS STYLE!!!
	f(++i,++i);
}

int main(int argc, char** argv)
{
	Test4();
	Test5();
	return 0;
}
